using Assets.Scripts.GDK;
using DG.Tweening;
using UnityEngine;

namespace Brick
{
	public class KaiheAnim : gdk_base_UI
	{
		public RectTransform leftItem;

		public RectTransform rightItem;

		private int maxSize = 34;

		private int minSize = 13;

		public override void OnStart()
		{
			OpenState();
		}

		public void OpenAnim()
		{
			DOTween.To(() => 99, delegate (int x)
			{
				int num = x * (maxSize - minSize) / 100 + minSize;
				leftItem.sizeDelta = new Vector2(num, 61f);
				rightItem.sizeDelta = new Vector2(num, 61f);
			}, 1, 1f).OnComplete(delegate
			{
				OpenState();
			});
		}

		public void CloseAnim()
		{
			DOTween.To(() => 10, delegate (int x)
			{
				int num = x * (maxSize - minSize) / 100 + minSize;
				leftItem.sizeDelta = new Vector2(num, 61f);
				rightItem.sizeDelta = new Vector2(num, 61f);
			}, 99, 1f).OnComplete(delegate
			{
				CloseState();
			});
		}

		public void OpenState()
		{
			leftItem.sizeDelta = new Vector2(minSize, 61f);
			rightItem.sizeDelta = new Vector2(minSize, 61f);
		}

		public void CloseState()
		{
			leftItem.sizeDelta = new Vector2(maxSize, 61f);
			rightItem.sizeDelta = new Vector2(maxSize, 61f);
		}
	}
}

